package com.edfu.core.testmgt.vo;

import java.io.Serializable;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement (name = "Question")
public class Question implements Serializable {

	private static final long serialVersionUID = -7294602336783331161L;
	
	private long id;
	private String code;
	private String question;
	private String description;
	private String solution;
	private QuestionType questionType;
	private FormatType formatType;
	private boolean objective;
	private double postivieMarks;
	private double negativeMarks;
	private Set<Option> options;
	private Set<Option> answers;
	private long duration;
	private boolean active;
	private Set<Test> tests;
	private double difficultyLevel;
	private double discriminatoryPower;
	private double guessingFactor;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getQuestion() {
		return question;
	}
	public void setQuestion(String question) {
		this.question = question;
	}
	
	public QuestionType getQuestionType() {
		return questionType;
	}
	public void setQuestionType(QuestionType questionType) {
		this.questionType = questionType;
	}
	
	public FormatType getFormatType() {
		return formatType;
	}
	public void setFormatType(FormatType formatType) {
		this.formatType = formatType;
	}
	
	public boolean isObjective() {
		return objective;
	}
	public void setObjective(boolean objective) {
		this.objective = objective;
	}
	
	public double getPostivieMarks() {
		return postivieMarks;
	}
	public void setPostivieMarks(double postivieMarks) {
		this.postivieMarks = postivieMarks;
	}
	
	public double getNegativeMarks() {
		return negativeMarks;
	}
	public void setNegativeMarks(double negativeMarks) {
		this.negativeMarks = negativeMarks;
	}
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getSolution() {
		return solution;
	}
	public void setSolution(String solution) {
		this.solution = solution;
	}
	
	public Set<Option> getOptions() {
		return options;
	}
	public void setOptions(Set<Option> options) {
		this.options = options;
	}
	
	public Set<Option> getAnswers() {
		return answers;
	}
	public void setAnswers(Set<Option> answers) {
		this.answers = answers;
	}	
	
	public long getDuration() {
		return duration;
	}
	public void setDuration(long duration) {
		this.duration = duration;
	}
	
	public boolean isActive() {
		return active;
	}
	public void setActive(boolean active) {
		this.active = active;
	}
	
	public Set<Test> getTests() {
		return tests;
	}
	public void setTests(Set<Test> tests) {
		this.tests = tests;
	}
	
	public double getDifficultyLevel() {
		return difficultyLevel;
	}
	public void setDifficultyLevel(double difficultyLevel) {
		this.difficultyLevel = difficultyLevel;
	}
	
	public double getDiscriminatoryPower() {
		return discriminatoryPower;
	}
	public void setDiscriminatoryPower(double discriminatoryPower) {
		this.discriminatoryPower = discriminatoryPower;
	}
	
	public double getGuessingFactor() {
		return guessingFactor;
	}
	public void setGuessingFactor(double guessingFactor) {
		this.guessingFactor = guessingFactor;
	}
	
	@Override
	public String toString() {
		return "Question [id=" + id + ", code=" + code + ", question="
				+ question + "]";
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Question other = (Question) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		
		return true;
	}	

}
